Some conventional operating systems provide a capability to employ a non-volatile memory device (i.e., a peripheral device operable to provide auxiliary storage and/or memory to a computer, such as a flash memory USB drive) as a block or file-level cache for slower storage devices (e.g., a disk storage medium, or one or more storage devices accessible via a network), to improve the performance of the operating system and/or applications. In this respect, because read and write operations can be performed significantly faster from or to a non-volatile memory device (hereinafter referred to as a “cache device” for simplicity) than from or to a slower storage device, using a cache device to cache data stored on such a slower device offers opportunities to significantly improve the speed of input/output (I/O) operations of operating systems and/or applications. To this end, the Microsoft Windows Vista operating system, produced by Microsoft Corporation of Redmond, Wash., includes a feature known as ReadyBoost which allows users to employ cache devices to cache data also residing in a slower storage device (referred to hereinafter as “disk storage” or “disk” for convenience, although it should be understood that these terms refer generally to any storage mechanism(s) and/or device(s) to which I/O is typically performed more slowly than a cache device, including storage devices accessible via a network).
Employing a cache device to cache data stored on disk may be accomplished using a cache manager component, which in some implementations is a driver implemented in the operating system's I/O stack. FIGS. 1A-1B depict example high-level processes 10A-10B whereby a cache manager component 100 manages the caching of data to cache device 110. Cache device 110 may be coupled, using wired and/or wireless communications infrastructure and protocol(s), to a computer (not shown) on which cache manager 100 resides. For example, cache device 110 may be removable from the computer (e.g., comprise a flash memory USB drive), non-removable and/or accessible to the computer via one or more wired and/or wireless networks.
At the start of the process 10A (FIG. 1A), a write request is received by cache manager 100 specifying that data should be written to address X on disk storage (i.e., cached volume 120). Cache manager 100 processes the request by causing the data to be written to address X on cached volume 120 in operation 101, and also to address Y on cache device 110 in operation 102. Process 10B (FIG. 1B) includes operations performed thereafter when a read request is received specifying that the data stored at address X on cached volume 120 should be read. Cache manager 100 determines that the data is cached on cache device 110 at address Y, and causes the data at address Y to be read in operation 103. The data is then served from the cache device to satisfy the read request in operation 104.
The cache manager maintains a mapping of disk addresses (e.g., address X) to corresponding cache addresses (e.g., address Y) in metadata, and this “cache metadata” is usually employed in reading from or writing to the cache device. Typically, cache metadata is maintained in memory and accessed by the cache manager when I/O requests are received. As such, when a read request is received by the cache manager which is directed to disk offset X, the cache manager uses the cache metadata to determine that the data is also stored at cache offset Y, and to satisfy the request by causing the data to be read from cache offset Y rather than disk offset X. When a write request is received by the cache manager which is directed to disk offset X, the cache manager employs the cache metadata to determine whether the data at that disk address is also stored in cache. If so (e.g., if the data is stored at cache address Y), the cache manager may cause the data to be written to the appropriate address in cache, or evict the cache contents at that address. If not, the cache manager may cause the data to be written to cache, and may update the cache metadata so that future reads to disk offset X may instead be serviced from the data stored on cache.
Conventional operating systems are capable of supporting cache devices with relatively limited storage capacity. For example, the ReadyBoost feature of the Windows Vista operating system supports cache devices with up to a four gigabyte storage capacity. (At the time Windows Vista was released, the maximum storage capacity of cache devices was approximately two gigabytes). The storage capacity of cache devices has grown rapidly in recent years, with some cache devices providing a storage capacity of up to sixteen gigabytes, which may store the equivalent of thirty-two gigabytes of data when compressed.